<template>
 <view>
	 首页
	 <view @click="a">跳转到登录</view>
 </view>

</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				jwt:'',
				role:'',
			}
		},
		onLoad() {
			this.panduan();
		},
		methods: {
			a(){
				uni.navigateTo({
					url:'/pages/index/login'
				})
			},
			panduan(){
				this.jwt =localStorage.getItem("jwt")
				if(this.jwt!=null){
					this.role =localStorage.getItem("role")
					if(this.role==1){
						//跳转到顾客页面
						uni.navigateTo({
							url:'/pages/customer/customer'
						}) 
					}else if(this.role == 2) {
						//跳转到商家页面
						uni.navigateTo({
							url:'/pages/shop/shop'
						}) 
					}else if(this.role == 3) {
						//跳转到管理员页面
						uni.navigateTo({
							url:'/pages/admin/admin'
						}) 
					}
				}else{
					uni.navigateTo({
						url:'/pages/index/login'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
		@import "uview-ui/index.scss";
		@import '/colorui/main.css';
		@import '/colorui/icon.css';
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
